<?php

	//前台主页页面
	class IndexAction extends Action{
	
		//加载对应的前台主页面模版
		public function index(){
			
			
			//实例化商品信息模型
			$goods=D('Goods');
			$data=$goods->where("g_is_new=1")->order('g_id desc')->select();
			$this->assign('data',$data);
			$data1=$goods->where("g_is_hot=1")->order('g_id desc')->select();
			$this->assign('data1',$data1);
			
			//实例化分类模型
			$cate=D('Category');
			$data2=$cate->where('c_parent_id !=0')->select();
			$this->assign('data2',$data2);
			$this->display('index');
		}
		
		//显示商品详情页面
		public function deta(){
			//商品ID
			$id=$_GET['id']+0;			

			//实例化商品信息模型
			$goods=D('Goods');
			$row=$goods->find($id);
			
			$data=$goods->where("g_is_new=1")->order('g_id desc')->select();
			$this->assign('data',$data);
			$data1=$goods->where("g_is_hot=1")->order('g_id desc')->select();
			$this->assign('data1',$data1);
			$this->assign('row',$row);
			$this->display();
		}
		
		
	}